using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Haidou.Wpf.Util.Converters;

public class InvertedVisibility : IValueConverter
{
	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
	{
		return value is not Visibility visibility
			? DependencyProperty.UnsetValue
			: visibility != Visibility.Visible ? Visibility.Visible : parameter is string param ? Visibility.Hidden : Visibility.Collapsed;
	}

	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
	{
		return Binding.DoNothing;
	}
}